package com.zhiyou100.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhiyou100.model.PublishTheProject;
import com.zhiyou100.service.PublishtheprojectService;

/**
 * 
 * @author Administrator
 *   项目查询
 */
@Controller
public class PublishtheprojectController {

	@Autowired
	private PublishtheprojectService  ps;
	@RequestMapping("/find/Publishtheproject")
	public String findps(@RequestParam(value="")String name,
			@RequestParam(value="")int pageNo
			,Model model) {
		System.out.println("进入/find/Publishtheproject   Controller"+name);
		Map<String,Object> map = new HashMap<>();
		map.put("name", name);
		//先声明分页在调用服务层
		PageHelper.startPage(pageNo, 3);
		//调用服务层
		List<PublishTheProject> publishtheproject = ps.findAll(map);
		PageInfo<PublishTheProject> pageInfo = new PageInfo<>(publishtheproject);
		model.addAttribute("map",map );
		model.addAttribute("page",pageInfo );
		model.addAttribute("publishtheproject",pageInfo.getList() );
		
		return "forward:/view/gyzc.jsp";
		
	}
}
